﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Collections.Generic;

using PowerCreator.LMS.Action.Core;
using PowerCreator.LMS.Action.Entity;

public partial class sysadmin_RoleManager_ActionHeader : PowerCreator.LMS.Web.Base.BaseUserControlPage
{
    PowerCreator.LMS.Web.Action.Action opAction = new PowerCreator.LMS.Web.Action.Action();

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            string url = Request.Url.ToString();
            if (Request.QueryString["RoleID"] != null)
            {
                ViewState["RoleID"] = Request.QueryString["RoleID"].ToString();
            }

            BindRpt();
        }
    }

    private void BindRpt()
    {
        List<SysColumnTypeItem> list = SysColumnType.GetAllTypeItem();
        ArrayList array = new ArrayList();

        foreach (SysColumnTypeItem var in list)
        {       
            var.Name = GetLanageValueByKey(var.LanageChar, PowerCreator.LMS.Language.LanagetItemType.MenuColumnSys);
            if (var.Id.ToString() == "1")
            {                            
                array.Add(string.Format("<a href=\"SetBaseAction.aspx?sysid={1}&RoleID={2}\">{0}</a>", var.Name, var.Id.ToString(), ViewState["RoleID"].ToString()));
            }
            else if(var.Id.ToString() == "2")
            {
                //array.Add(string.Format("<a href=\"SetCatalogAction.aspx?sysid={1}&RoleID={2}\">{0}</a>", var.Name, var.Id.ToString(), ViewState["RoleID"].ToString()));
            }
            else if (var.Id.ToString() == "3")
            {
                //array.Add(string.Format("<a href=\"SetBaseAction.aspx?sysid={1}&RoleID={2}\">{0}</a>", var.Name, var.Id.ToString(), ViewState["RoleID"].ToString()));
            }
            else if (var.Id.ToString() == "4")
            {
                //array.Add(string.Format("<a href=\"SetBaseAction.aspx?sysid={1}&RoleID={2}\">{0}</a>", var.Name, var.Id.ToString(), ViewState["RoleID"].ToString()));
            }
            else if (var.Id.ToString() == "5")
            {
                //array.Add(string.Format("<a href=\"SetBaseAction.aspx?sysid={1}&RoleID={2}\">{0}</a>", var.Name, var.Id.ToString(), ViewState["RoleID"].ToString()));
            }
            else if (var.Id.ToString() == "6")
            {
                //array.Add(string.Format("<a href=\"SetBaseAction.aspx?sysid={1}&RoleID={2}\">{0}</a>", var.Name, var.Id.ToString(), ViewState["RoleID"].ToString()));
            }
            else if (var.Id.ToString() == "7")
            {
                //array.Add(string.Format("<a href=\"SetBaseAction.aspx?sysid={1}&RoleID={2}\">{0}</a>", var.Name, var.Id.ToString(), ViewState["RoleID"].ToString()));
            }        
        }
        rptSysColumnType.DataSource = array;
        rptSysColumnType.DataBind();

        if (ViewState["RoleID"] != null)
        {
            VOTRole vo = opAction.LoadRole(int.Parse(ViewState["RoleID"].ToString()));
            lnkbtn_RoleName.Text = vo.RoleName;
        }
        else
        {
            lnkbtn_RoleName.Text = GetLanageValueByKey("msg_Actionhead_noname", PowerCreator.LMS.Language.LanagetItemType.MenuColumnSys);
        }
    }
}
